package com.stx.day0916;

/**
 * packageName com.stx.day0916
 *
 * @author YangYi
 * @className Students
 * @date 2025/9/16
 * @description TODO
 */
public class Students {
    String name;
    int num;
    int age;
    String sex;
    String mobile;
    private double scores;

    // TODO setter，getter 快捷键
    public void setScores(double scores){
        if(scores != 20){
            System.out.println("分数初始化为20");
            return;
        }
        this.scores = scores;
    }

    public void subScores(){
        if(scores > 10){
            System.out.println("扣分超过限制");
            return;
        }
        if(scores <= 0){
            System.out.println("无分可扣，交钱");
            return;
        }
        this.scores -= 10;
    }

    public void eat(){
        System.out.println("下课吃饭");
    }

    public void play(){
        System.out.println("运动");
    }

    @Override
    public String toString() {
        return "Students{" +
                "name='" + name + '\'' +
                ", num=" + num +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                ", mobile=" + mobile +
                ", scores=" + scores +
                '}';
    }
}
